package cn.arnold.offer.iqiyi;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        //input
        Scanner scanner = new Scanner(System.in);
        String[] str = scanner.nextLine().split(" ");
        int[] nums = new int[str.length];
        for (int i = 0; i < nums.length; i++) {
            nums[i] = Integer.parseInt(str[i]);
        }
        List<List<Integer>> ans = new ArrayList<List<Integer>>();
        ans = threeSum(nums);
        //行内大小排序
        for (List<Integer> e : ans) {
            Collections.sort(e);
        }
        //行间大小排序
        for (int i = 0; i < ans.size(); i++) {
            for (int j = 0; j <ans.size()-1-j ; j++) {
                Integer first_i = ans.get(j).get(0);
                Integer first_j = ans.get(j+1).get(0);
                if ( first_i != first_j && first_i > first_j){
                    List<Integer> temp = new ArrayList<Integer>(ans.get(j));
                    ans.set(j,ans.get(j+1));
                    ans.set(j+1,temp);
                }
            }
        }
        for (int i = 0; i < ans.size(); i++) {
            for (int j = 0; j <ans.size()-1-j ; j++) {
                Integer first_i = ans.get(j).get(0);
                Integer first_j = ans.get(j+1).get(0);
                Integer second_i = ans.get(j).get(1);
                Integer second_j = ans.get(j+1).get(1);
                if ( first_i == first_j && second_i > second_j){
                    List<Integer> temp = new ArrayList<Integer>(ans.get(j));
                    ans.set(j,ans.get(j+1));
                    ans.set(j+1,temp);
                }
            }
        }
        for (int i = 0; i < ans.size(); i++) {
            for (int j = 0; j <ans.size()-1-j ; j++) {
                Integer first_i = ans.get(j).get(0);
                Integer first_j = ans.get(j+1).get(0);
                Integer second_i = ans.get(j).get(1);
                Integer second_j = ans.get(j+1).get(1);
                Integer third_i = ans.get(j+1).get(2);
                Integer third_j = ans.get(j+1).get(2);
                if ( second_i == second_j && third_i > third_j){
                    List<Integer> temp = new ArrayList<Integer>(ans.get(j));
                    ans.set(j,ans.get(j+1));
                    ans.set(j+1,temp);
                }
            }
        }
        //output
        for (List<Integer> e : ans) {
            System.out.println(e);
        }
    }

    static public List<List<Integer>> threeSum(int[] nums) {
        List<List<Integer>> ans = new ArrayList<List<Integer>>();
        int len = nums.length;
        if (nums == null || len < 3) {
            return ans;
        }
        Arrays.sort(nums);
        for (int i = 0; i < len; i++) {
            if (nums[i] > 0) {
                break;
            }
            if (i > 0 && nums[i] == nums[i - 1]) {
                continue;
            }
            int L = i + 1;
            int R = len - 1;
            while (L < R) {
                int sum = nums[i] + nums[L] + nums[R];
                if (sum == 0) {
                    ans.add(Arrays.asList(nums[i], nums[L], nums[R]));
                    //去重
                    while (L < R && nums[L] == nums[L + 1]) {
                        L++;
                    }
                    while (L < R && nums[R] == nums[R - 1]) {
                        R--;
                    }
                    L++;
                    R--;
                } else if (sum < 0) {
                    L++;
                } else if (sum > 0) {
                    R--;
                }
            }
        }
        return ans;
    }
}
